


import request from "@/utils/axios";

export interface ChartsParams {
  serviceName?: string;
  endpointName: string;
  start: string;
  end: string;
  percent?: number[];
}

enum Api {
  GET_SCENCE_CHAOS_LIST = '/scence/chaos/list',
  GET_LATENCY = '/scence/latency',
  GET_THROUGHPUT = '/scence/throughput',
  GET_RESPONSETIMEPERCENTILE = '/scence/responsetimepercentile',
}
export function getScenceChaosListApi(instance:any) {
  return request(
    { url: instance ? Api.GET_SCENCE_CHAOS_LIST + `?instance=${instance}` : Api.GET_SCENCE_CHAOS_LIST ,
    method: 'get' },
  );
}
export function getScenceLatencyApi(params: ChartsParams) {
  return request(
    { 
      url: Api.GET_LATENCY +  `?serviceName=${params.serviceName}&endpointName=${params.endpointName}&start=${params.start}&end=${params.end}`,
      method: 'post',
    },
  );
}

export function getScenceThroughputApi(params: ChartsParams) {
  return request(
    { 
      url: Api.GET_THROUGHPUT +  `?serviceName=${params.serviceName}&endpointName=${params.endpointName}&start=${params.start}&end=${params.end}`,
      method: 'post',
    },
  );
}


export function getResponsetimepercentileApi(params: ChartsParams) {
  return request(
    { 
      url: Api.GET_RESPONSETIMEPERCENTILE +  `?serviceName=${params.serviceName}`,
      method: 'post',
      data: params
    },
  );
}